<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.mysql.cj.jdbc.ha.BalanceStrategy"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%request.setCharacterEncoding("UTF-8"); %>
<%@page import="java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>主界面</title>
    <link rel="stylesheet" href="./css/left-nav.css">
    <link rel="stylesheet" href="./css/right-card.css">
    <link rel="stylesheet" href="./css/balance.css">
    <link rel="stylesheet" href="./css/account.css">
    <link rel="stylesheet" href="./css/manage.css">
    <link rel="stylesheet" href="./css/filter.css">
    <link rel="stylesheet" href="./css/common.css">
    <style>
    	.left_nav,.right{
            background: url(https://images-1300275660.cos.ap-shanghai.myqcloud.com/caiwu3.png) no-repeat center;
            background-attachment: fixed;
            background-size: cover;      
        }
        .right .right_card {
   			background-color: rgb(46, 45, 62);
		}
		.right .right_card ul .account .input1{
			background-color: rgb(176,196,222);
		}
		.left_nav ul li span {
		    width: 25px;
		    height: 25px;
		    position: absolute;
		    top: 0;
		    left: 20px;
		    background: url(https://images-1300275660.cos.ap-shanghai.myqcloud.com/%E7%90%86%E8%B4%A2.png) no-repeat center;
		    background-size: cover;
		}
		.right .right_card ul .manage .pay_amount{
		    background: url(./images/金额.png) no-repeat center;
		    background-size: cover;
		}
		
		.right .right_card ul .manage .pay_number{
		    background: url(./images/数.png) no-repeat center;
		    background-size: cover;
		}
		.right .right_card ul .manage button{
			margin-top: 40px;
		}
    </style>
</head>
<body>
<!-- 左侧导航 -->
    <div class="left_nav" id="nav_left">
        <div class="head clearfix">
            <div class="head_icon"></div>
            <div class="head_word">财务管理系统</div>
        </div>
        <ul>
            <li>
                <span></span>
                理财服务
            </li>
            <li>
                <span class="second_icon"></span>
                余额计算
            </li>
            <li>
                <span class="third_icon"></span>
                支付方式
            </li>
            <li>
                <span class="fourth_icon"></span>
                记账
            </li>
            <li>
                <span class="fifth_icon"></span>
                筛选账单
            </li>
        </ul>
    </div>

    <!-- 右侧内容 -->
    <div class="right">
        <div class="right_card">

            <ul id="content_right">
                <!-- 理财服务 -->
                <li class="item manage manage-money" id="manage1">
                	<jsp:useBean id="finance" scope="page" class="wacai.FinanceInfo" />
                	<jsp:setProperty property="*" name="finance"/>
                    <div class="title">理财服务</div>

                    <form action="home.jsp" method="post">
                        <ul>
                            <li>
                                <span></span>
                                <input type="text" placeholder="理财金额" value="<%=request.getParameter("amount")==null?"":request.getParameter("amount") %>" size="30" name="amount"></li>
                            <li>
                                <select name="type" id="licai">
                                	<option value="no">请选择理财产品</option>
                                    <option value="余额宝" id="yuebao">余额宝</option>
                                    <option value="京东小金库" id="jd">京东小金库</option>
                                </select>
                            </li>
                            <li>
                                <span class="manage_day"></span>
                                <input type="text" placeholder="理财天数"  value="<%=request.getParameter("days")==null?"":request.getParameter("days") %>"size="30" name="days">
                            </li>
                        </ul>
                        <button>理财</button>
                        
                    </form>

<%
//计算理财后的收入
	try{
		int days = Integer.parseInt(finance.getDays());
		int amount = Integer.parseInt(finance.getAmount());
		String type = finance.getType();
		session.setAttribute("status",finance.getType());
		double income = 0;
		if(type.equals("余额宝")){
			income = amount*0.0292/365*days;                     		
		}else if(type.equals("京东小金库")){
			income = amount*0.0295/365*days;
		}else if(type.equals("no")){
			out.print("<script type='text/javascript'>alert('请选择一款理财产品！');</script>");
			response.setHeader("Refresh","0.1;url=home.jsp");
		}
		%>
		<div class="result">
			<%
			out.print("您通过"+type+"存入"+amount+"元,经过"+days+"天的预计收入是"+income+"元。");%>
		</div>
		<%
	}catch(NumberFormatException e){
		out.print("");
	}
%>              
                </li>

				<!-- 余额计算 -->
                <li class="item balance" id="balanceMoney">
                	
                    <div class="title">余额计算</div>
                    <%if(request.getParameter("cash")==null){ %>
                    <form action="CalculateMoney.jsp" method="post" name="calForm" id="search">
	                    <ul>
	                        <li>
	                            <span></span>
	                            <input id="cash" name="cash" type="text" placeholder="基础现金" size="30">
	                        </li>
	
	                        <li>
	                            <span class="balance_salary"></span>
	                            <input id="incomes" name="incomes" type="text" placeholder="收入" size="30">
	                        </li>
	
	                        <li>
	                            <span class="balance_rent"></span>
	                            <input id="rent" name="rent" type="text" placeholder="房租" size="30">
	                        </li>	                       	
        	                				
	                        <li>
	                            <span class="balance_recharge"></span>
	                            <input id="charges" name="charges" type="text" placeholder="水电" size="30">
	                        </li>
	
	                        <li>
	                            <span class="balance_eat"></span>
	                            <input id="eat" name="eat" type="text" placeholder="吃饭" size="30">
	                        </li>
	
	                        <li>
	                            <span class="balance_treat"></span>
	                            <input id="treat" name="treat" type="text" placeholder="请吃饭" size="30">
	                        </li>
	
	                        <li>
	                            <span class="balance_ktv"></span>
	                            <input id="ktv" name="ktv" type="text" placeholder="ktv" size="30">
	                        </li>	                        
	                    </ul>
							<button></button>	                      	                        
                    </form>                
 <%}%>
                </li>
                
                <!-- 支付方式 -->
                <li class="item pay manage">
                    <div class="title">支付方式</div>
					<%if(request.getParameter("payAmount")==null){ %>
                    <form action="paySuccess.jsp" method="post">
                        <ul>
                            <li>
                                <span class="pay_amount"></span>
                                <input type="text" name="payAmount" placeholder="支付金额">
                            </li>
                            <li>
                                <select name="payType">
                               	 	<option value="no">请选择付款方式</option>
                                    <option value="支付宝花呗">支付宝花呗</option>
                                    <option value="京东白条">京东白条</option>
                                    <option value="信用卡">信用卡</option>
                                </select>
                            </li>
                            <li>
                                <span class="pay_number"></span>
                                <input type="text" name="payDays" placeholder="分期数">
                            </li>
                        </ul>
                        <button>支付</button>
                    </form>
<%}%>
                </li>

                <!-- 记账 -->
                <li class="item account">
                    <div class="title">记账</div>
                    <p>发生日期</p>
                    <form action="record.jsp">
	                    <input type="date" class="input1" name="createTime" placeholder="2019-06-01" size="80">
	                    <br>
	                    <p>记账金额</p>
	                    <input type="text" name="amount" placeholder="记账金额" size="80">
	                    <br>
	                    <select class="select1" name="type">
	                        <option value="收入">收入</option>
	                        <option value="支出">支出</option>
	                    </select>
	
	                    <select class="select2" name="category">
	                        <option value="房租">房租</option>
	                        <option value="水电">水电</option>
	                        <option value="吃饭">吃饭</option>
	                        <option value="请吃饭">请吃饭</option>
	                        <option value="ktv">ktv</option>
	                    </select>
	                    <br>
	                    <button id="button4">记一笔</button>
                    </form>
                </li>

                <!-- 筛选账单 -->
                <li class="item filter">
                    <div class="title">筛选账单</div>
                    <form action="filterMoney.jsp" method="post">
                        <ul>
                            <li>
                                <p>过滤出大于你输入的金额的记账记录</p>
                            </li>
                            <li>
                                <span></span>
                                <input type="text" name="filterNum" placeholder="请输入金额">
                            </li>
                            <li>
                                <button type="submit" id="button5">过滤</button>
                            </li>
                        </ul>                  
                    </form>
                </li>
            </ul>
        </div>
    </div>

</body>
<script src="./JS/home.js"></script>
<script type="text/javascript">
window.onload = function(){
	document.getElementById("manage1").style.display = "block";
}
</script>
</html>